    let user = { username:"admin1",password:"12345" }

    let fs = require('fs');
    let read = fs.readFileSync(__dirname + '/persons.json','utf8');
    let persons = JSON.parse(read)
    var tag = persons.findIndex((item)=>{
          return item.username == user.username;
    })
    if(tag == -1){
        persons.push(user);
        console.log(persons);
        fs.writeFileSync(__dirname + '/persons.json',JSON.stringify(persons),'utf8');
    }else{
        console.log('登录成功');
    }